Add filterdefs to hold protos for filter functions and extern of waypt_head
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 4 Oct 2005 14:54:48 +0000 (14:54 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 4 Oct 2005 14:54:48 +0000 (14:54 +0000)
so we can more easily finger the remaining formats that violate the intended
'static-ness' of that symbol.

15 files changed:
gpsbabel/arcdist.c
gpsbabel/defs.h
gpsbabel/discard.c
gpsbabel/duplicate.c
gpsbabel/filter_skeleton.c
gpsbabel/filter_vecs.c
gpsbabel/filterdefs.h [new file with mode: 0644]
gpsbabel/main.c
gpsbabel/polygon.c
gpsbabel/position.c
gpsbabel/reverse_route.c
gpsbabel/smplrout.c
gpsbabel/sort.c
gpsbabel/stackfilter.c
gpsbabel/trackfilter.c

index 800c45dd424487b5af04b55d7757d53e407d7c97..27499bf1e272908ca0d5b4127b4f222acaaa2198 100644 (file)
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
 
  */
-#include <stdio.h>
 #include "defs.h"
+#include "filterdefs.h"
 #include "grtcirc.h"
 
 #define MYNAME "Arc filter"
 
-extern queue waypt_head;
-
 static double pos_dist;
 static char *distopt = NULL;
 static char *arcfileopt = NULL;
index eb77b094088e1c6719ec142c6082a72924d1b811..a89ea7dd7a5dbfee3d80d0536beafe85991b3a97 100644 (file)
@@ -516,14 +516,6 @@ typedef struct style_vecs {
 } style_vecs_t;
 extern style_vecs_t style_list[];
 
-typedef struct filter_vecs {
-       filter_init f_init;
-       filter_process f_process;
-       filter_deinit f_deinit;
-       filter_exit f_exit;
-       arglist_t *args;
-} filter_vecs_t;
-
 void waypt_init(void);
 void route_init(void);
 void waypt_disp(const waypoint *);
@@ -539,12 +531,6 @@ void exit_vecs(void);
 void disp_formats(int version);
 void printposn(const double c, int is_lat);
 
-filter_vecs_t * find_filter_vec(char * const, char **);
-void free_filter_vec(filter_vecs_t *);
-void disp_filters(int version);
-void disp_filter_vecs(void);
-void exit_filter_vecs(void);
-
 #ifndef DEBUG_MEM
 void *xcalloc(size_t nmemb, size_t size);
 void *xmalloc(size_t size);
index 8e7936e18a0d6f8237f1df9795bdb10fe8ba1bc5..0973313baae232d5b7859744d0bb8a679caf51e6 100644 (file)
@@ -18,8 +18,9 @@
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
 
  */
-#include <stdio.h>
+
 #include "defs.h"
+#include "filterdefs.h"
 
 static char *hdopopt = NULL;
 static char *vdopopt = NULL;
index 5556be28ee73bef21e17f8b11bf97d3afcf3bd8d..31372ec6e4c58f1b68ca32e1ccb4d2fff7deaec6 100644 (file)
@@ -20,8 +20,7 @@
  */
 #include <stdio.h>
 #include "defs.h"
-
-extern queue waypt_head;
+#include "filterdefs.h"
 
 static char *snopt = NULL;
 static char *lcopt = NULL;
@@ -159,7 +158,8 @@ compare(const void *a, const void *b)
 
 }
 
-void
+
+static void
 duplicate_process(void)
 {
        waypoint * waypointp;
@@ -172,7 +172,6 @@ duplicate_process(void)
        int i, ct = waypt_count();
        wpt_ptr *htable, *bh;
        queue *elem, *tmp;
-       extern queue waypt_head;
 
        htable = (wpt_ptr *) xmalloc(ct * sizeof(*htable));
        bh = htable;
@@ -250,20 +249,10 @@ duplicate_process(void)
        }
 }
 
-void
-duplicate_init(const char *args) 
-{
-}
-
-void
-duplicate_deinit(void) 
-{
-}
-
 filter_vecs_t duplicate_vecs = {
-       duplicate_init,
+       NULL,
        duplicate_process,
-       duplicate_deinit,
+       NULL,
        NULL,
        dup_args
 };
index fe6e3b33c0d86e05f0c42715ec38e05bcad3181a..28c58e2e7321f2051b5533271a8703308b6a0dba 100644 (file)
@@ -46,7 +46,7 @@ arglist_t filter_skeleton_args[] = {
 *******************************************************************************/
 
 static void
-filter_skeleton_init(const char *args)         /* optional */
+filter_skeleton_init(const char *args)         /* optional.  If not needed, delete and replace entry in vecs with NULL  */
 {
 }
 
@@ -60,7 +60,7 @@ filter_skeleton_process(void) /* this procedure must be present in vecs */
 }
 
 static void
-filter_skeleton_deinit(void)           /* optional */
+filter_skeleton_deinit(void)           /* optional.   If not needed, delete and replace entry in vecs with NULL*/
 {
 }
 
index 1aa5ca1b4546277144173e202f16cbe997c5b0da..3a5568f85981575d0a3ea235f1e8caba8191c320 100644 (file)
@@ -19,8 +19,8 @@
 
  */
 
-#include <stdio.h>
 #include "defs.h"
+#include "filterdefs.h"
 
 typedef struct {
        filter_vecs_t *vec;
diff --git a/gpsbabel/filterdefs.h b/gpsbabel/filterdefs.h
new file mode 100644 (file)
index 0000000..19272c3
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+    Filter definitions.
+
+    Copyright (C) 2005  Robert Lipe, robertlipe@usa.net
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ */
+
+
+
+/*
+ * Filters can do some things that modules really shouldn't do.
+ * This is our (weak) attempt to make that distinction.
+ */
+
+extern queue waypt_head;
+
+typedef struct filter_vecs {
+       filter_init f_init;
+       filter_process f_process;
+       filter_deinit f_deinit;
+       filter_exit f_exit;
+       arglist_t *args;
+} filter_vecs_t;
+
+filter_vecs_t * find_filter_vec(char * const, char **);
+void free_filter_vec(filter_vecs_t *);
+void disp_filters(int version);
+void disp_filter_vecs(void);
+void exit_filter_vecs(void);
+
index 06e7325715dd224187c2fc3157202e680b64b466..a1b735987694723ca6c15eac36da5bbfbe03a444 100644 (file)
@@ -19,6 +19,7 @@
 
 
 #include "defs.h"
+#include "filterdefs.h"
 #include "cet.h"
 #include "cet_util.h"
 #include <ctype.h>
index 174eec4c647d947dc539b378cb0d21c2e498cda5..c2d9ca5d58544022420657a0b70225a5ff1a9350 100644 (file)
 
  */
 #include "defs.h"
+#include "filterdefs.h"
 
 #define MYNAME "Polygon filter"
 
-extern queue waypt_head;
-
 static char *polyfileopt = NULL;
 static char *exclopt = NULL;
 
index 75f0988df275974f1315098f26edc4922a67ee8e..261708c7a2a62f11a6c4def1e0bd4a2db22201cb 100644 (file)
 
  */
 #include "defs.h"
+#include "filterdefs.h"
 #include "grtcirc.h"
 
 #ifndef M_PI
 #  define M_PI 3.14159265358979323846
 #endif
 
-extern queue waypt_head;
 static route_head *cur_rte = NULL;
 
 static double pos_dist;
index 5ba3a7e32590c48f634c6e228a74c4df255ede70..82b9848eb8808bcc7ecc86dd109ab18ee7cd8c6a 100644 (file)
@@ -18,8 +18,8 @@
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
 
  */
-#include <stdio.h>
 #include "defs.h"
+#include "filterdefs.h"
 
 #define MYNAME "Route reversal filter"
 
index bd9fb8dcdc7976d6b35775d36508316654ec68a2..7688582dccd8e5b8c2739104ab201575aec2998c 100644 (file)
@@ -18,8 +18,8 @@
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
 
  */
-#include <stdio.h>
 #include "defs.h"
+#include "filterdefs.h"
 #include "grtcirc.h"
 
 #define MYNAME "Route simplification filter"
index e91af8317aaa42ccbfe38f7c2b2c827d0c3f70f9..b0c29c25a9c3e6202795590e25cfe1a72c5deef0 100644 (file)
@@ -19,8 +19,7 @@
 
  */
 #include "defs.h"
-
-extern queue waypt_head;
+#include "filterdefs.h"
 
 typedef enum {
        sm_unknown = 0,
index 494947042c850ef68621882b248b01abdf5f0322..38bfd4854c50bd6e728f92f9e1391e8c612cc839 100644 (file)
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
 
  */
-#include <stdio.h>
+
 #include "defs.h"
+#include "filterdefs.h"
 
 #define MYNAME "Stack filter"
 
-extern queue waypt_head;
-
 static char *opt_push = NULL;
 static char *opt_copy = NULL;
 static char *opt_pop = NULL;
index acd1bb43beb7b93bf5849c64bdd0d302cf270e47..5797dadb3cd6a69bf1d2d1658b231a4056c9cd32 100644 (file)
     2005-07-29: warning fixes
  */
  
-#include <stdio.h>
-#include <time.h>
 #include <ctype.h>
 #include "defs.h"
+#include "filterdefs.h"
 #include "strptime.h"
 
 #define MYNAME "trackfilter"
@@ -86,20 +85,6 @@ static int track_ct = 0;
 static int track_pts = 0;
 static int opt_interval = 0;
 
-/*******************************************************************************
-* dummy callbacks for track_disp_all
-*******************************************************************************/
-
-static void 
-trackfilter_noop_w(const waypoint *w)
-{
-}
-
-static void 
-trackfilter_noop_t(const route_head *h)
-{
-}
-
 /*******************************************************************************
 * helpers
 *******************************************************************************/
@@ -661,7 +646,7 @@ trackfilter_init(const char *args)
 
            /* check all tracks for time and order (except merging) */
        
-           track_disp_all(trackfilter_fill_track_list_cb, trackfilter_noop_t, trackfilter_noop_w);
+           track_disp_all(trackfilter_fill_track_list_cb, NULL, NULL);
            qsort(track_list, track_ct, sizeof(*track_list), trackfilter_init_qsort_cb);
        }
 }